<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<title>小辰星空</title>
	{css href="__CSS__/bootstrap.min.css"}
	{css href="__CSS__/font-awesome.min.css"}
	{css href="__CSS__/toastr.min.css"}
	{css href="__CSS__/cropper.min.css"}
	{css href="__CSS__/prism.css"}
	{css href="__CSS__/chat.css"}
	{css href="__CSS__/iconfont.css"}
</head>

<style type="text/css">
	.dropdown-toggle::after {
		display:none;
	}
	.img-circle {
		border-radius: 50%;
	}
	.img-lg {
		width:80px;
		height:80px;
	}
	.img-md {
		width:50px;
		height:50px;
	}
	.img-sm {
		width:35px;
		height:35px;
	}
	.a-notdecoration:hover {
		text-decoration: none;
	}
	.custom-file-input:lang(zh) ~ .custom-file-label::after {
	  content: "浏览";
	}
	.custom-file-label::after {
	  content: "浏览";
	}
	.avator_image_preview {
		height: 132px;
		width: 132px;
		overflow: hidden; 
	}
</style>


<nav class="navbar navbar-expand navbar-light bg-white shadow-sm">
 	<div class="container">
 		<a class="navbar-brand text-primary" href="/index"><strong>小辰星空</strong></a>
 		<div class="collapse navbar-collapse">
 			<div class="navbar-nav mr-auto">
        		<a id="index" class="nav-link nav-item" href="/index">首页</a>
        		<a id="topic" class="nav-link nav-item" href="/index/topic?topic_id=1">专题</a>
        		<!-- <a id="topic" class="nav-link nav-item" href="#">专题</a> -->
	  		</div>
	  		{empty name="Think.session.fullname"}
			<ul class="navbar-nav">
	  			<li class="nav-item">
	  				<a class="nav-link" href="/index/login"><i class="fa fa-sign-in"></i>&nbsp;登录</a> 				
	  			</li>
	  			<li class="nav-item">
					<a class="nav-link" href="/index/register">注册</a>	  				
	  			</li>
	  		</ul>
			{else /}
	  		<ul class="navbar-nav">
				<li class="nav-item dropdown mr-2">
	  				<a class="nav-link dropdown-toggle" id="fullname" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-user"></i>&nbsp;{$Think.session.fullname}</a>
	  				<div class="dropdown-menu" aria-labelledby="fullname">
					    <a class="dropdown-item" href="/index/person?user_id={$Think.session.user_id}">个人主页</a>
					    <a class="dropdown-item" href="#">浏览历史</a>
					    <a class="dropdown-item" href="/index/setting">个人设置</a>
					  </div>
	  			</li>
	  			<li class="nav-item mr-2">
					<a class="nav-link" href="/index/notice?type=1"><i class="fa fa-comment"></i>&nbsp;消息<small><span id="message_num" class="badge badge-danger badge-pill"></span></small></a>	  				
	  			</li>
	  			<li class="nav-item mr-2">
					<a class="nav-link" href="/index/publish"><i class="fa fa-edit"></i>&nbsp;发布</a>	  				
	  			</li>
	  			<li class="nav-item">
					<a class="nav-link" href="/index/login/logout"><i class="fa fa-sign-out"></i>&nbsp;退出</a>	  				
	  			</li>
			</ul>
			{/empty}
 		</div>
 	</div>
</nav>




{js href="__JS__/jquery.min.js"}
{js href="__JS__/bootstrap.min.js"}
{js href="__JS__/bootstrap.bundle.min.js"}
{js href="__JS__/toastr.min.js"}
{js href="__JS__/tinymce.min.js"}
<!-- {js href="__JS__/tinymce.js"} -->
{js href="__JS__/cropper.min.js"}
{js href="__JS__/jquery-cropper.min.js"}
{js href="__JS__/prism.js"}
{js href="__JS__/chat.js"}

<script type="text/javascript">
	$(function () {
		if (window.location.pathname == '/index/topic') {
			$('#topic').addClass('active');
		}
		else {
			$('#index').addClass('active');
		}

		$('.dropdown-toggle').dropdown();
		toastr.options = {
		    closeButton: true,
		    debug: false,
		    progressBar: false,
		    positionClass: "toast-top-full-width",
		    onclick: null,
		    showDuration: "200",
		    hideDuration: "800",
		    timeOut: "3000",
		    extendedTimeOut: "1000",
		    showEasing: "swing",
		    hideEasing: "linear",
		    showMethod: "fadeIn",
		    hideMethod: "fadeOut"
	    };
	    getMessageCount();
	});

	function getMessageCount() {
    	$.get("/index/notice/getAllNum", 
    	function(result) {
    		if (result.status == 'success') {
    			if (result.data != 0) {
    				$('#message_num').html(result.data);
    				$('#message_num').show();
    			}
    			else {
    				$('#message_num').hide();
    			}
  			}
  			if (result.status == 'error') {
  				$('#message_num').hide();
  				$('#message_num').html(0);
  			}
    	}, "json");
    };

    var firstInterval;
    function firstAlert(){
	    if(firstInterval) {
	    	clearInterval(firstInterval);
	    }
	    getMessageCount()
	    firstInterval = setInterval('firstAlert()', 1000 * 60 * 5);
	}
	firstAlert();
</script>
